package com.nextpro.media.encoder;

import com.nextpro.media.ui.UIMediaFrame;

import javax.swing.*;
import java.util.Set;

/**
 * Created by Administrator on 14-2-20.
 */
public class EncoderRunnable implements Runnable {
    private Set<String> filePaths;
    private JProgressBar bar;

    public EncoderRunnable(Set<String> filePath,JProgressBar bar) {
        this.filePaths = filePath;
        this.bar = bar;
    }



    @Override
    public void run() {
        Encoder encoder = PlatFormEncoder.createEncoder(null);
        int length =100;
        int value = 0;
        if (!filePaths.isEmpty()){
            length = 100/filePaths.size();
        }
        for(String filePath:filePaths){
            encoder.encode(filePath);
            value+=length;
            bar.setValue(value);
        }

    }
}
